import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

import com.yishe.framework.ui.easyui.Column;
import com.yishe.util.document.ExcelExport;


public class POITest {
	public static void main(String[] args) throws FileNotFoundException {
		List<Column> one = new ArrayList<Column>();
		Column a1 = new Column("name","姓名",(short)10);
		a1.setRowspan((short)2);
		Column a2 = new Column("idcard","身份证",(short)15);
		a2.setRowspan((short)2);
		Column a3 = new Column();
		a3.setColspan((short)3);
		a3.setTitle("信息");
		one.add(a1);
		one.add(a2);
		one.add(a3);
		
		List<Column> two = new ArrayList<Column>();
		two.add(new Column("gender","性别",(short)6));
		two.add(new Column("age","年龄",(short)6));
		two.add(new Column("email","邮件",(short)6));
		
		List<student> data = new ArrayList<student>();
		data.add(new student("张三", "1321123131", "男", 12, "yishe@foxmail.com"));
		data.add(new student("李四", "1321123131", "男", 12, "yishe@foxmail.com"));
		data.add(new student("王武", "1321123123", "男", 12, "yishe@foxmail.com"));
		data.add(new student("哈哈", "1321123123", "男", 12, "yishe@foxmail.com"));
		
		FileOutputStream out = new FileOutputStream("D:/123.xls");
		
		ExcelExport<student> util = new ExcelExport<student>();
		try {
			util.exportExcel(new List[]{one,two}, data, out);
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
}

